﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WebApplication1.ServiceReference1;
using System.Data.Services.Client;
using System.IO;
using System.Data;


namespace Football
{
    public partial class TeamDetails : System.Web.UI.Page
    {
        private Uri serviceUri = new Uri("http://localhost:50000/FootballService.svc/");
        WebApplication1.ServiceReference1.FotbalEntities context;
        protected void Page_Load(object sender, EventArgs e)
        {
            context = new WebApplication1.ServiceReference1.FotbalEntities(serviceUri);
            if (!IsPostBack)
            {
                BindDetaliiEchipa();
                Bindxml();
                
            }
           
                

        }
        private void BindDetaliiEchipa()
        {
            DataServiceQuery<Echipe> echipe =
            context.CreateQuery<Echipe>("/Echipes");

            var query = from e in echipe
                        where e.CodEchipa == Decimal.Parse(Server.UrlDecode(Request.QueryString["CodEchipa"]))
                        select e;

            FormView_Team.DataSource = query;
            FormView_Team.DataBind();
        }
        private void Bindxml()
        {
             // Creates a DataSet and loads it with an Xml Content
            DataSet aDataSet = new DataSet();
            //string myURL = "http://localhost:51791/Content/MeniuEchipa.xml";
            aDataSet.ReadXml(Server.MapPath("Content/MeniuEchipa.xml"));
            // Bind the DataSet to the grid view            
            ListView_ListaEchipeMenu.DataSource = aDataSet;
            ListView_ListaEchipeMenu.DataBind();
        }
    }
}